java 编译出错 --->菜鸟

来源:百度知道 编辑:UC知道 时间:2024/05/27 14:26:51
public class Text{
int b=30;

public static void test1( int a){
a=70;
Text t= new Text();
test1 s=t.test1(a);
System.out.println( s.a);
}
public static void main(String[] args) {

test1(70);

System.out.println( t.b);

}
}
刚学没多久,不要见笑,查不到错误原因..........郁闷中

test1 s=t.test1(a);

test1是方法,怎么能这么用呢?整个test1方法,甚至整个程序不知道写了什么。如果要说编译错误的话更是一大堆。

我建议你目前不要凭自己的想象去写程序,看看教程里的基本知识,学习一下别人的例子。

早都忘了,帮不了你了

回答者: shuangwhywhy - 高级魔法师 六级 2-6 22:28
说得很对。但我还是帮你修改一下吧!
public class Text{
static int b=30;

public static void test1( int a){
b=a;
System.out.println(b);
}
public static void main(String[] args) {
Text t= new Text();
System.out.println(t.b);
int a=70;
t.test1(a);
}
}
我郁闷了,你这是什么程序,都不知道你要做什么?反正我这个是可以运行的。只能这样了。